package com.pc_project.service.impl;

import com.pc_project.domain.Message;
import com.pc_project.mapper.MessageDao;
import com.pc_project.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageServiceImpl implements MessageService {

    @Autowired
    MessageDao messageDao;

    @Override
    public List<Message> queryMessage(Integer lid) {
        return messageDao.queryMessage(lid);
    }

    @Override
    public Message queryMessageByMid(Integer mid) {
        return messageDao.selectByPrimaryKey(mid);
    }

    @Override
    public void deleteMessageByMid(Integer mid) {
        messageDao.deleteByPrimaryKey(mid);
    }

    @Override
    public boolean insert(Message message) {
        int insert = messageDao.insert(message);
        return insert > 0;
    }


}
